﻿using System.Collections.Generic;

namespace System.Linq
{
    /// <summary>
    /// Extension methods for interacting with collections.
    /// </summary>
    public static class CollectionExtensions
    {
        /// <summary>
        /// Provides a fast iteration in reverse order over a list.
        /// </summary>
        /// <param name="items">The items.</param>
        /// <returns></returns>
        public static IEnumerable<TSource> FastReverse<TSource>(this IList<TSource> items)
        {
            for (int i = items.Count - 1; i >= 0; i--)
            {
                yield return items[i];
            }
        }
    }
}
